<?php
/**@var \Weline\Framework\View\Template $this */
/**@var \Weline\Backend\Block\ThemeConfig $themeConfig */
$themeConfig = \Weline\Framework\Manager\ObjectManager::getInstance(\Weline\Backend\Block\ThemeConfig::class);
?>
<!DOCTYPE html>
<!--
 *@Author       秋枫雁飞
 *@Email        aiweline@qq.com
 *@Forum        https://bbs.aiweline.com
 *@DESC         后台共用头部
-->
<html lang='en' <?= ('rtl' === $themeConfig->getThemeModel()) ? " dir=\"rtl\"" : '' ?>>
<head>
    @template(Weline_Admin::common/head.phtml)
    <!-- jquery.mCustomScrollbar 插件 -->
    <link href="@static(Weline_Admin::/libs/jquery.mCustomScrollbar/jquery.mCustomScrollbar.css)" rel="stylesheet"/>
    <!-- Responsive Table css -->
    <link href='@static(Weline_Admin::assets/libs/admin-resources/rwd-table/rwd-table.min.css)' rel='stylesheet'
          type='text/css'/>
    <!-- Sweet Alert-->
    <link href='@static(Weline_Admin::assets/libs/sweetalert2/sweetalert2.min.css)' rel='stylesheet' type='text/css'/>
    <title><?= __('Weline Admin 管理面板') ?></title>
</head>

<body <?= $themeConfig->getLayouts() ?? ''; ?>>

<!--页头工具条 开始-->
@template(Weline_Admin::common/page/loading.phtml)
<!--页头工具条 结束-->

<!-- <body data-layout="horizontal" data-topbar="dark"> -->

<!-- 开始 页面 -->
<div id="layout-wrapper">


    <!--页头工具条 开始-->
    <w:block class='Weline\Admin\Block\Backend\Page\Topbar'/>
    <!--页头工具条 结束-->

    <!-- ========== Topnav Start ========== -->
    <!--页头菜单栏 开始-->
    <w:block class='Weline\Admin\Block\Backend\Page\Topnav'/>
    <!--页头菜单栏 结束-->

    <!-- ========== Left Sidebar Start ========== -->
    <!--左侧菜单栏 开始-->
    @template(Weline_Admin::common/left-sidebar.phtml)
    <!--左侧菜单栏 结束-->


    <!-- ============================================================== -->
    <!-- Start right Content here -->
    <!-- ============================================================== -->
    <div class="main-content">

        <div class='page-content'>
            <div class='container-fluid'>
                <!-- start page title -->
                <div class='row'>
                    <div class='col-12'>
                        <div class='page-title-box d-sm-flex align-items-center justify-content-between'>
                            <h4 class='mb-sm-0'>
                                <lang>i18n国际化>国家>地区>词典</lang>
                            </h4>

                            <div class='page-title-right'>
                                <ol class='breadcrumb m-0'>
                                    <li class='breadcrumb-item'><a href='javascript: void(0);'>
                                            <lang>系统配置</lang>
                                        </a></li>
                                    <li class='breadcrumb-item'>
                                        <a href="@backend-url('*/backend/countries')">
                                            <lang>i18n国际化</lang>
                                        </a>
                                    </li>
                                    <li class='breadcrumb-item'>
                                        <a href="@backend-url('*/backend/countries')">
                                            <lang>国家</lang>
                                        </a>
                                    </li>
                                    <li class='breadcrumb-item'>
                                        <a href="@backend-url('*/backend/countries/locales')?country_code={{req
                                        .country_code}}">
                                            <lang>地区</lang>
                                        </a>
                                    </li>
                                    <li class='breadcrumb-item active'>
                                        <a href="@backend-url('*/backend/countries/locale/words')?country_code={{req
                                        .country_code}}&code={{req.params.code}}">
                                            <lang>词典</lang>
                                        </a>
                                    </li>
                                </ol>
                            </div>

                        </div>
                    </div>
                </div>
                <!-- end page title -->
                <!-- start page message -->
                <div class='row'>
                    <template>Weline_Component::message.phtml</template>
                </div> <!-- end message -->
                <div class='row'>
                    <div class='col-12'>
                        <div class='card'>
                            <div class='card-body'>
                                <h4 class='card-title'>
                                    <lang>词典</lang>
                                </h4>
                                <p class='card-title-desc'>
                                    <lang>根据地区翻译来自前端采集到的词.</lang>
                                <p>
                                    <lang>只需要在前端或者后端刷新页面，或者使用命令：php bin/w i18n:collect
                                        也可以收集到大部分词。
                                    </lang>
                                </p>
                                <p>
                                    <lang>提示：使用词典收集功能请先开启在线收集词语功能。开启命令：php bin/w
                                        translate:model:set online
                                    </lang>
                                </p>
                                </p>
                                <p class="card-title-desc">
                                    <lang>展示语言：</lang>
                                    {{target_locale.name}}（{{target_locale.code}}）
                                </p>
                                <p class='card-title-desc'>
                                    <lang>操作：</lang>
                                    <a href="@backend-url('*/backend/countries/locale/words/collect')?country_code={{req.params.country_code}}&code={{req
                                    .code}}">
                                        <lang>更新</lang>
                                    </a>
                                    <span class='fas fa-question-circle' data-trigger='hover' data-toggle='popover'
                                          data-content='@lang(刷新来自前端采集到的词。)'></span>
                                    <a href="@backend-url('*/backend/countries/locale/words/collect')?country_code={{req.params.country_code}}&code={{req
                                    .code}}">
                                        <lang>导出语言包</lang>
                                        <lang>（尚未开发）</lang>
                                    </a>
                                    <a href="@backend-url('*/backend/countries/locale/words/collect')?country_code={{req.params.country_code}}&code={{req
                                    .code}}">
                                        <lang>导入语言包</lang>
                                        <lang>（尚未开发）</lang>
                                    </a>
                                    <a class="text-warning" href="@backend-url('*/backend/countries/locale/words/push')?country_code={{req
                                    .country_code}}&code={{req
                                    .code}}">
                                        <lang>发布</lang>
                                    </a>
                                    <lang>在线收集词典功能状态：</lang>
                                    <lang>{{translate_mode}}</lang>
                                    <a class="text-info" href="@backend-url('*/backend/countries/locale/words/enable')?country_code={{req
                                    .country_code}}&code={{req
                                    .code}}">
                                        <lang>实时</lang>
                                    </a>
                                    <a class="text-info" href="@backend-url('*/backend/countries/locale/words/disable')?country_code={{req
                                    .country_code}}&code={{req
                                    .code}}">
                                        <lang>缓存</lang>
                                    </a>
                                </p>
                                <div class='table-rep-plugin'>
                                    <p class='card-title-desc'>
                                        <b>
                                            <lang>当前词典（语言包）：</lang>
                                        </b>
                                        {{locale.code}}（{{locale.ln_display_name}}）
                                        <b>
                                            <lang>所属国家：</lang>
                                        </b>
                                        {{locale.display_name}}（{{locale.country_code}}）
                                        <span><lang>一共</lang>{{total}} <lang>个词条</lang></span>
                                    </p>
                                    <!-- search form -->
                                    <div class='row'>
                                        <div class='col-12'>
                                            <block class='Weline\Component\Block\Form\Search'
                                                   id='translate-words-search'
                                                   action='*/backend/countries/locale/words'
                                                   method='get'
                                                   keyword='search' value=''
                                                   params="code,country_code"
                                                   placeholder='请输入要翻译的词'></block>
                                        </div>
                                    </div>
                                    <!-- end search form -->
                                    {{pagination}}
                                    <div class='table-responsive mb-0 mCustomScrollbar' data-pattern='priority-columns'>
                                        <table id='words-table' class='table table-striped table-bordered table-edits'>
                                            <thead>
                                            <tr>
                                                <th data-priority='1'><?= __('编辑') ?></th>
                                                <th data-priority='1'><?= __('词') ?></th>
                                                <th data-priority='1'><?= __('翻译') ?></th>
                                                <th data-priority='1'><?= __('收集时间') ?></th>
                                                <th data-priority='1'><?= __('翻译时间') ?></th>
                                                <th data-priority='1'><?= __('删除') ?></th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <notempty name="words">
                                                <foreach name="words" item="word" key="key">
                                                    <tr data-id="{{word.word}}">
                                                        <td class='co-action'>
                                                            <a class='btn btn-outline-secondary btn-sm edit'
                                                               title='<?= __('编辑') ?>'>
                                                                <i class='fas fa-pencil-alt'></i>
                                                            </a>
                                                        </td>
                                                        <td class='co-name'>{{word.word}}</td>
                                                        <td data-field='translate' data-word='{{word.word}}'
                                                            data-code="{{req.params.code}}"
                                                            data-country-code="{{req.params.country_code}}"
                                                            data-md5="{{word.md5}}" class='co-name'>{{word
                                                            .translate}}
                                                        </td>
                                                        <td class='co-name'>{{word.create_time}}</td>
                                                        <td class='co-name'>{{locale.update_time}}</td>
                                                        <td class='co-action'>
                                                            <a class='btn btn-outline-secondary btn-sm word-restore'
                                                               data-md5='{{word.md5}}'
                                                               data-code='{{req.params.code}}'
                                                               data-country-code='{{req.params.country_code}}'
                                                               title='@lang{恢复}'>
                                                                <i class='mdi mdi-restore-alert'
                                                                   data-md5='{{word.md5}}'
                                                                   data-code='{{req.params.code}}'
                                                                   data-country-code='{{req.params.country_code}}'></i>
                                                            </a>
                                                        </td>
                                                    </tr>
                                                </foreach>
                                            </notempty>
                                            </tbody>
                                        </table>
                                        <empty name='words'>
                                            <lang>请</lang>
                                            <a href="@backend-url('*/backend/countries/locale/words/collect')?country_code={{req
                                            .params.country_code}}&code={{req.params.code}}">
                                                <lang>更新（收集）</lang>
                                            </a>
                                            <lang>词典</lang>
                                        </empty>
                                        {{pagination}}
                                    </div>

                                </div>

                            </div>
                        </div>
                    </div> <!-- end col -->
                </div> <!-- end row -->
            </div> <!-- container-fluid -->
        </div>
        <!-- End Page-content -->

        <footer class="footer">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-6">
                        <script>document.write(new Date().getFullYear())</script>
                        © Weline.
                    </div>
                    <div class="col-sm-6">
                        <div class="text-sm-end d-none d-sm-block">
                            Crafted with <i class="mdi mdi-heart text-danger"></i> By <a
                                    href="https://www.aiweline.com/">秋枫雁飞(aiweline)</a>
                        </div>
                    </div>
                </div>
            </div>
        </footer>

    </div>
    <!-- end main content-->

</div>
<!-- END layout-wrapper -->
<!--右边栏-->
@template(Weline_Admin::common/right-sidebar.phtml)

<!-- Table Editable plugin -->
<script src="@static(Weline_Admin::assets/libs/table-edits/build/table-edits.min.js)"></script>
<script src="@static(Weline_I18n::js/words-table-editable.init.js)"></script>
<script src='@static(Weline_Admin::/libs/jquery.mCustomScrollbar/jquery.mCustomScrollbar.concat.min.js)'></script>
<!-- Responsive Table js -->
<script src='@static(Weline_Admin::assets/libs/admin-resources/rwd-table/rwd-table.min.js)'></script>

<!-- Init js -->
<script src='@static(Weline_Admin::assets/js/pages/table-responsive.init.js)'></script>

<!-- Sweet Alerts js -->
<script src='@static(Weline_Admin::assets/libs/sweetalert2/sweetalert2.min.js)'></script>

<!-- Sweet alert init js-->
<script src='@static(Weline_I18n::js/sweet-alerts.init.js)'></script>
@template(Weline_Admin::common/footer.phtml)
</body>
</html>
